Ext.define('testleo.view.Contact', {
    extend: 'Ext.Panel',	
    alias: 'widget.contact',  
    config: {
	items :[{
            xtype : 'toolbar',
            docked: 'top',
            title: 'Contact Us'
        },{
            xtype: 'container',
            defaults: {
                xtype: 'button',
                margin: '10 10 0 10'
            },
            items: [
                {
                    cls: 'my-link',
		    html: '<a href="mailto:dacostacarl@gmail.com">Write email</a>'
                },
                {
                    cls: 'my-link',
		    html: '<a href="tel:+352621283645">Call</a>',
                },
		{
                    cls: 'my-link',
		    html: '<a href="http://maps.google.fr/maps?f=q&source=s_q&hl=fr&geocode=&q=5+Rue+de+Strassen,+Luxembourg,+Luxembourg&aq=0&oq=5+rue+de+stra&t=m&ie=UTF8&hq=&hnear=5+Rue+de+Strassen,+Luxembourg&z=16&vpsrc=0&iwloc=A">Go there</a>',
                },
                {
                    text: 'Add to contact',
                    handler: function() {
			var onSuccess = function (contact) {
						alert("Save Success");
					};
			
			var onError = function (contactError) {
							alert("Error = " + contactError.code);
							};
			
			// PhoneGap feature
			var contact = navigator.contacts.create();
			contact.displayName = "The compagny";
			contact.nickname = "The compagny";       //specify both to support all devices
			var phoneNumbers = [];
			phoneNumbers[0] = new ContactField('mobile', '+352621283645', true);
			contact.phoneNumbers = phoneNumbers[0] ; 
			
			var addresses = [];
			addresses[0] = new ContactField('adress', '5 rue de starssen L-2555 Luxembourg', false);
			contact.addresses = addresses[0];
			
			// save to device
			contact.save(onSuccess,onError);
                    }
                }
            ]
	}]
    }
});